package com.gupao.ldr.pattern.template;


/**
 * 饮料制作模版
 */
public class BeverageMakingTemplate {



    public void make(Drinks drinks, RawMaterial rawMaterial){

        //1.加原料
        rawMaterial.toConfigure(drinks);
        System.out.println();
        //2.加水
        addWater(drinks);
        //3.烧水
        boilWater();
        //4.加工
        machining();
        //5.混合
        blend(drinks);

    }

    private void blend(Drinks drinks) {
        System.out.println("混合 ");
    }

    private void machining() {
        System.out.println("加工");
    }

    private void boilWater() {
        System.out.println("烧水");
    }

    private void addWater(Drinks drinks) {
        System.out.println("加水");
    }


    public static void main(String[] args) {
        BeverageMakingTemplate beverageMakingTemplate = new BeverageMakingTemplate();
        beverageMakingTemplate.make(new CocaCola(), new RawMaterial() {
            public void toConfigure(Drinks drinks) {
                CocaCola cocaCola=(CocaCola)drinks;
                cocaCola.setCO2("50%");
                cocaCola.setLemon("20%");
            }
        });

    }

}
